﻿
package utils
{
	import data.ItemData;
	import data.PresetData;
	
	public class MediaRSS 
	{
		/** Parse button data **/
		public static function parse(dat:XML):Array 
		{
			var oItemData:ItemData;
			var aItemData:Array = new Array;
			
			for each (var i:XML in dat.children())
			{
				oItemData = new ItemData;
				
				oItemData.name = i.name;
				oItemData.type = i.type;
				oItemData.itemCategory = i.itemcategory;
				oItemData.category = i.category;
				
				aItemData.push(oItemData);
			}
			
			return aItemData;
		}
		
		/** Parse preset data **/
		public static function parsePreset(dat:XML):Array
		{
			var oPresetdata:PresetData;
			var aPresetData:Array = new Array;
			
			for each (var x:XML in dat.children())
			{
				oPresetdata = new PresetData;
				
				oPresetdata.mainColor = x.mainColor;
				oPresetdata.backgroundColor = x.backgroundColor;
				oPresetdata.backgroundAlpha = x.backgroundAlpha;
				oPresetdata.activeFontColor = x.activeFontColor;
				oPresetdata.fontColor = x.fontColor;
				oPresetdata.fontName = x.fontName;
				oPresetdata.ratingStarColor = x.ratingStarColor;
				oPresetdata.moduleBackgroundColor = x.moduleBackgroundColor;
				oPresetdata.moduleBackgroundAlpha = x.moduleBackgroundAlpha;
				oPresetdata.buttonFontColor = x.buttonFontColor;
				oPresetdata.buttonGradient = x.buttonGradient;
				oPresetdata.invertedButtonFontColor = x.invertedButtonFontColor;
				oPresetdata.invertedButtonColor = x.invertedButtonColor;
				oPresetdata.invertedButtonGradient = x.invertedButtonGradient;
				oPresetdata.tapButtonSelectedFontColor = x.tapButtonSelectedFontColor;
				oPresetdata.tapButtonSelectedGradient = x.tapButtonSelectedGradient;
				oPresetdata.subMenuButtonHoverBorderColor = x.subMenuButtonHoverBorderColor;
				oPresetdata.thumbGradient = x.thumbGradient;
				oPresetdata.thumbSelectedGradient = x.thumbSelectedGradient;
				oPresetdata.thumbActiveBorderColor = x.thumbActiveBorderColor;
				oPresetdata.scrollBarGradient = x.scrollBarGradient;
				oPresetdata.subMenuButtonFontColor = x.subMenuButtonFontColor;
				oPresetdata.subMenuButtonSelectedFontColor = x.subMenuButtonSelectedFontColor;
				oPresetdata.subMenuButtonSelectedgradient = x.subMenuButtonSelectedgradient;
				oPresetdata.subMenuDiverderColor = x.subMenuDiverderColor;
				oPresetdata.searchFieldFontColor = x.searchFieldFontColor;
				oPresetdata.playlistItemExpandButtonGradient = x.playlistItemExpandButtonGradient;
				oPresetdata.playlistItemExpandButtonIconColor = x.playlistItemExpandButtonIconColor;
				oPresetdata.scrollTrackGradient = x.scrollTrackGradient;
				oPresetdata.searchFieldGradient = x.searchFieldGradient;
				oPresetdata.searchResultBackgroundColor = x.searchResultBackgroundColor;
				oPresetdata.searchRowBackgroundColor = x.searchRowBackgroundColor;
				oPresetdata.searchResultAlternateRowBackgroundColor = x.searchResultAlternateRowBackgroundColor;
				
				aPresetData.push(oPresetdata);
			}
			
			return aPresetData;
		}
	}
}